package com.ruoyi.car.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.car.mapper.CarSpecMapper;
import com.ruoyi.car.domain.CarSpec;
import com.ruoyi.car.service.ICarSpecService;
import com.ruoyi.common.core.text.Convert;

/**
 * 车辆规格Service业务层处理
 * 
 * @author zls
 * @date 2020-03-29
 */
@Service
public class CarSpecServiceImpl implements ICarSpecService 
{
    @Autowired
    private CarSpecMapper carSpecMapper;

    /**
     * 查询车辆规格
     * 
     * @param id 车辆规格ID
     * @return 车辆规格
     */
    @Override
    public CarSpec selectCarSpecById(Long id)
    {
        return carSpecMapper.selectCarSpecById(id);
    }

    /**
     * 查询车辆规格列表
     * 
     * @param carSpec 车辆规格
     * @return 车辆规格
     */
    @Override
    public List<CarSpec> selectCarSpecList(CarSpec carSpec)
    {
        return carSpecMapper.selectCarSpecList(carSpec);
    }

    /**
     * 新增车辆规格
     * 
     * @param carSpec 车辆规格
     * @return 结果
     */
    @Override
    public int insertCarSpec(CarSpec carSpec)
    {
        carSpec.setCreateTime(DateUtils.getNowDate());
        return carSpecMapper.insertCarSpec(carSpec);
    }

    /**
     * 修改车辆规格
     * 
     * @param carSpec 车辆规格
     * @return 结果
     */
    @Override
    public int updateCarSpec(CarSpec carSpec)
    {
        carSpec.setUpdateTime(DateUtils.getNowDate());
        return carSpecMapper.updateCarSpec(carSpec);
    }

    /**
     * 删除车辆规格对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteCarSpecByIds(String ids)
    {
        return carSpecMapper.deleteCarSpecByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除车辆规格信息
     * 
     * @param id 车辆规格ID
     * @return 结果
     */
    @Override
    public int deleteCarSpecById(Long id)
    {
        return carSpecMapper.deleteCarSpecById(id);
    }
}
